<?php

/**
 * LicenseeMatch form.
 *
 * @package    cpfaizenay
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class LicenseeMatchForm extends BaseLicenseeMatchForm
{
  public function configure() {
      $user = sfContext::getInstance()->getUser()->getGuardUser();

      $dateWidget = new sfWidgetFormI18nDate(array(
          'format' => '%day%/%month%/%year%',
//          'month_format' => 'short_name',
          'culture' => 'fr'
        ));

     if ($this->isNew()) {
        $this->widgetSchema['updated_at'] = new sfWidgetFormInputHidden();
        $this->widgetSchema['modification_user_id'] = new sfWidgetFormInputHidden();

        $this->setDefault('created_at', date('d-m-Y') );
        $this->setDefault('updated_at', date('d-m-Y') );
    }else{
        $this->widgetSchema['updated_at'] = new sfWidgetFormJQueryDate(array(
          'culture' => 'fr',
          'date_widget' => $dateWidget,
          'image' => '/images/admin/icons/small/calendar.png',
          'config' => '{}',
        ));
    }

    $this->widgetSchema['created_at'] = new sfWidgetFormJQueryDate(array(
      'culture' => 'fr',
      'date_widget' => $dateWidget,
      'image' => '/images/admin/icons/small/calendar.png',
      'config' => '{}',
    ));

      $this->widgetSchema['datetime_match'] = new sfWidgetFormJQueryDate(array(
          'culture' => 'fr',
          'date_widget' => $dateWidget,
          'image' => '/images/admin/icons/small/calendar.png',
          'config' => '{}',
      ));
      $this->setDefault('datetime_match', date('d-m-Y') );

      $this->widgetSchema['opponent_licensee_number'] = new sfWidgetFormInputText();

      $this->widgetSchema['status'] = new sfWidgetFormSelectRadio(array('choices' => array('V' => 'V', 'D' => 'D')));
      $this->setDefault('status', 'V');

      $this->widgetSchema->setFormFormatterName('list');

      $this->setValidator['status'] = new sfValidatorChoice(array('choices' => array('V' => 'V', 'D' => 'D'), 'required' => true));
  }
}
